package com.lzmpt.imchat.ui.chatactivity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;

import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMCursorResult;
import com.hyphenate.easeui.widget.EaseExpandGridView;
import com.hyphenate.exceptions.HyphenateException;
import com.lzmpt.imchat.R;
import com.lzmpt.imchat.ui.BaseActivity;

import java.util.ArrayList;
import java.util.List;

public class ChatGroupDetailsActivity extends BaseActivity {
    private String groupId;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_group_details);
        groupId = getIntent().getStringExtra("groupId");
        initView();
    }

    private void initView() {

        List<String> memberList = new ArrayList<>();
        EMCursorResult<String> result = null;
        final int pageSize = 20;
        do {
            try {
                result = EMClient.getInstance().groupManager().fetchGroupMembers(groupId,
                        result != null ? result.getCursor() : "", pageSize);
            } catch (HyphenateException e) {
                e.printStackTrace();
            }
            memberList.addAll(result.getData());
        } while (!TextUtils.isEmpty(result.getCursor()) && result.getData().size() == pageSize);

        for (String name : memberList) {
            Log.e("TAG_EE", "------->" + name);
        }
    }


    public void back(View view) {
        setResult(RESULT_OK);
        finish();
    }


}
